﻿using System;
using System.Diagnostics;
using System.Text;
using System.Collections.Generic;
using Common.Unity.Extensions.Configuration;
using Common.Unity.Testing.Objects;
using Microsoft.Practices.ObjectBuilder2;
using Microsoft.Practices.Unity;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Testing.Core;

namespace Common.Unity.Extensions.Serialization.Testing
{
	/// <summary>
	/// Summary description for XmlSerializationPolicyTests
	/// </summary>
	[TestClass]
	public class XmlSerializationPolicyTests
	{
		[TestMethod, DeploymentItem( "Common.Unity.Extensions.Serialization.Testing/Resources/NamedObjectFile.xml" )]
		public void VerifyNamedObjectSerializedProperlyFromFileXml()
		{
			var target = Configuration.Container.Resolve<INamedObject>( "FileBased" );
			Assert.AreEqual( "Named Object from File", target.Name );
		}

		[TestMethod]
		public void VerifyNamedObjectSerializedProperlyFromAssemblyResourceXml()
		{
			var target = Configuration.Container.Resolve<INamedObject>( "AssemblyResourceBased" );
			Assert.AreEqual( "Named Object from Assembly-based resource", target.Name );
		}
 
		[TestMethod]
		public void VerifyNamedObjectSerializedProperlyFromTypeResourceXml()
		{
			var target = Configuration.Container.Resolve<INamedObject>( "TypeResourceBased" );
			Assert.AreEqual( "Named Object from Type-based Resource", target.Name );
		}
	}
}
